/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.admin.dao.impl;

import vip.dexian.admin.dao.AdminDao;
import vip.dexian.admin.entity.Admin;
import vip.dexian.common.query.Filter;
import vip.dexian.core.base.dao.BaseDaoImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

/**
 * 管理员DaoImpl
 *
 * @author 挺好的 2023年06月05日 08:45:00
 */
@Repository ("adminDaoImpl")
public class AdminDaoImpl extends BaseDaoImpl <Admin, Long> implements AdminDao {


    /**
     * 根据用户名查找管理员
     *
     * @param username
     *         用户名
     *
     * @return {@link vip.dexian.admin.entity.Admin}
     */
    @Override
    public Admin findByUsername (String username) {
        if (StringUtils.isEmpty(username)) {
            return null;
        }

        Filter filter = Filter.eq("username", username);
        return super.find(filter);
    }

}

